"""unitool URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from rest_framework.routers import DefaultRouter

from hony.views import (
    AuthorViews, ArticleViews, ArticleListView, ArticleDetailView,
    SeriesListView, StationListView, ArticleSeriesListView, ArticleStationListView,
    WxXCXArticleViews
)
from hony.views import (
    get_password,
    weixin_token
    )


router = DefaultRouter()

router.register(r'article', ArticleViews, basename='文章')
router.register(r'author', AuthorViews, basename='作者')
router.register(r'wxapi/v1/article', WxXCXArticleViews, basename='小程序文章列表')

urlpatterns = [
    path('passwd/<int:num>/', get_password, name="passwd"),
    path('wxtoken', weixin_token, name="token"),
    path('article_list/<int:station>/<int:series>/', ArticleListView.as_view(), name='list'),
    path('article_list/<int:station>/', ArticleListView.as_view(), name='list_station'),
    # path('article/series/<int:series>/', ArticleSeriesListView.as_view(), 'article_series'),
    # path('article/station/<int:station>/', ArticleStationListView.as_view(), 'article_station'),
    path('series/<int:series>/', SeriesListView.as_view(), name='series'),
    path('sta/<int:station>/', StationListView.as_view(), name='station'),
    path('article_detail/<int:pk>.html', ArticleDetailView.as_view(), name='detail')
]

urlpatterns += router.urls
